package com.ecommerce.dal.common;

import java.util.List;

import com.ecommerce.dal.entity.MembershipCard;
import com.ecommerce.dal.service.impl.MembershipCardManagerService;

public class TestMembershipCard {

	public TestMembershipCard(MembershipCardManagerService membershipCardManagerService) {
		MembershipCard membershipCard1 = new MembershipCard();
		long id = (long)(Math.random()*(Math.pow(10, 10)));
		System.out.println("Test random Id: "+id+"\n");
		membershipCard1.setMembershipCardId(id);
		membershipCard1.setCardPrice(30);
		
		membershipCardManagerService.saveMembershipCard(membershipCard1);
		
		MembershipCard membershipCard2 = membershipCardManagerService.retrieveMembershipCard(id);
		System.out.println("membershipCard Id: "+membershipCard2.getMembershipCardId() + " , \nmembershipCard Price: "+ membershipCard2.getCardPrice());
		List<MembershipCard> membershipCardList = membershipCardManagerService.retrieveAllMembershipCards();
		for(MembershipCard membershipCard : membershipCardList){
			System.out.println("Card Id: "+ membershipCard.getMembershipCardId()+ " ,  Card Price: "+membershipCard.getCardPrice() );
		}
	}

}
